11-Printing to different lines or same line.py.py


Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...


Code Snippet

print("Example 1")
for i in range(3):
        print("*")
#This will print each star one after the other (default - new line)

print()
print()

print("Example 2")
for i in range(3):
    #set a default END character (this will print each star on the same line)
        print("*", end="")

print()
print()

print("Example 3")
for i in range(3):
    #set the default end character to be a space (stars are a little more spaced out!)
        print("*", end=" ")

print()
print()
print("Example 3")
for i in range(3):
    #set a default end character (this will print a squiggle after each star)
        print("*", end="~")
    
    
    
    
    
                    

Try it yourself